/*
sq880.h
offer sq880 motor driver control function api 
designed by lunanting

---------------------------
2020-07-30 09:55:51
create file
---------------------------

*/
#ifndef __SQ880_H
#define __SQ880_H

#include "../../../1km/bsp/base_type.h"

/**********************data type define******************************/
//run type
typedef enum{
    sq880_fw=1,         //1=正转
    sq880_bk,           //2=反转
    sq880_fw_jog,       //3=正转点动
    sq880_bk_jog,       //4=反转点动
    sq880_slow_stop,    //5=减速停机
    sq880_fast_stop,    //6=自由停机==急停
    sq880_clear_error,  //7=故障复位
    sq880_jog_stop,     //8=点动停止
}SQ880_run_type;


//sq880 class
typedef struct{
    u8 init;    //init state
    u8 port;    //uart port
    int speed;  //uart speed
    u8 slave_id;    //modbus slave id

}SQ880_class;




/************************function extern***********************/
extern int xp_sq880_init(u8 port,int speed,u8 slave_id);    //init sq880
extern int xp_sq880_set_run(SQ880_run_type sta);    //set motor driver run state
extern int xp_sq880_set_freq(u16 freq); //set motor driver run frequency


extern int xp_sq880_debug(char *type,char *fun,char *param);

#endif
//end of the file
